home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / terms / kermit / b / ikmmac.asm < prev    next >
Encoding:
Assembly Source File  |  1992-09-29  |  35.4 KB  |  449 lines

  1. *COPY                                                 DMSFREE           00800000
  2.          MACRO                                                          00801000
  3. &LABEL   DMSFREE &DWORDS=(0),&ERR=                                      00802000
  4. .* Obtain free storage block: len=8*(R0).  Returns ptr in R1, but       00803000
  5. .*    preserves registers 2-14                                          00804000
  6. .*  &DWORDS= length in doublewords should be in R0,                     00805000
  7. .*  &ERR= branch if failure                                             00806000
  8.          GBLC  &KVRSN,&KSYS                                    @SC89027 00806100
  9.          AIF   ('&KVRSN' EQ '4.2' OR '&KSYS' EQ '').VOK        @SC90072 00806200
  10.    MNOTE 16,'* * * --> IKMMAC version number should be &KVRSN' @SC89027 00806300
  11. .VOK     ANOP                                                  @SC89027 00806400
  12. &LABEL   LREG  0,&DWORDS                                       @SC86299 00807000
  13.          SLA   0,3                                             @SC86299 00808000
  14.          AIF   ('&ERR' NE '').COND                             @SC86345 00809000
  15.          GETMAIN R,LV=(0)                                      @SC86299 00810000
  16.          MEXIT                                                          00811000
  17. .COND    GETMAIN R,LV=(0)                                               00812000
  18.  SLR 15,15                                                              00813000
  19.          LTR   15,15                                           @SC86345 00814000
  20.          BNZ   &ERR                                            @SC86345 00815000
  21.          MEND                                                           00816000
  22. *COPY                                                 DMSFRET           00817000
  23.          MACRO                                                          00818000
  24. &LABEL   DMSFRET &DWORDS=(0),&LOC=(1),&ERR=                             00819000
  25. .* Return free storage block: len=8*(R0), adr=(R1).  Preserve R2-14.    00820000
  26. .*  &DWORDS= length in doublewords should be in R0, &LOC= adr (in R1),  00821000
  27. .*  &ERR= branch if failure                                             00822000
  28. &LABEL   LREG  0,&DWORDS                                       @SC86299 00823000
  29.          SLA   0,3                                             @SC86299 00824000
  30.          FREEMAIN R,LV=(0),A=&LOC                              @SC86299 00825000
  31.          MEND                                                           00826000
  32. *COPY                                                 RTEXT             00827000
  33.          MACRO                                                          00828000
  34. &LABEL   RTEXT  &BUF,&PROMPT=,&E=                                       00829000
  35. .* Read from the terminal, possible prompt.  Get length read in R0.     00830000
  36. .*  &1: read buffer (len=130) (LA), &PROMPT(1)= prompt buf. if any      00831000
  37. .*  (LA/R), &PROMPT(2)= prompt length (LA/R), &E= branch if error       00832000
  38. &LABEL   DS    0H                                              @SC86299 00833000
  39.          AIF   (T'&PROMPT EQ 'O').NOPR                         @SC87268 00834000
  40.          KCALL SUPFNC,7,E=RTE&SYSNDX Skip prompt if stacked    @SC88095 00835000
  41.          TPUT  &PROMPT(1),&PROMPT(2),ASIS                      @SC87268 00836000
  42. .NOPR    ANOP                                                           00837000
  43. RTE&SYSNDX KCALL GETLIN,&BUF,E=&E                              @SC88095 00838000
  44.          MEND                                                           00839000
  45. *COPY                                                 SAVEF             00840000
  46.          MACRO                                                          00841000
  47. &LABEL   SAVEF &TICK,&E=                                       @SC88168 00842000
  48. .* Update disk directory for given file (ticket ptr in R1)              00843000
  49. .*  &1: adr of file access ticket (A), &E= branch on error              00844000
  50.          MEND                                                           00845000
  51. *COPY                                                 WRITF             00846000
  52.          MACRO                                                          00847000
  53. &LABEL   WRITF &TICK,&BUFFER=,&BSIZE=,&E=                               00848000
  54. .* Write to a disk file (ticket ptr in R1)                              00849000
  55. .*  &1: adr of file access ticket returned by OPENF (A),                00850000
  56. .*  &BUFFER= data ptr (LA/R), &BSIZE= data length (LA/R) - if either is 00851000
  57. .*  given, it replaces FDB value (see OPENF), &E= branch on error       00852000
  58. &LABEL   L     1,&TICK                                                  00853000
  59.          AIF   ('&BUFFER' EQ '').WSZ                                    00854000
  60.          LREG  15,&BUFFER                                               00855000
  61.          ST    15,FDBBUFF-FABD(1)                                       00856000
  62. .WSZ     AIF   ('&BSIZE' EQ '').WGO                                     00857000
  63.          LREG  15,&BSIZE                                                00858000
  64.          ST    15,FDBBSIZ-FABD(1)                                       00859000
  65. .WGO     LA    0,10               Write a record to a file...           00860000
  66.          KCALL DISKIO,E=&E                                              00861000
  67.          MEND                                                           00862000
  68. *COPY                                                 READF             00863000
  69.          MACRO                                                          00864000
  70. &LABEL   READF &TICK,&NONUM,&BUFFER=,&BSIZE=,&E=                        00865000
  71. .* Read from disk file (see WRITF)                                      00866000
  72. .*  &2: NONUM means chop off numbers                                    00867000
  73. &LABEL   L     1,&TICK                                                  00868000
  74.          AIF   ('&BUFFER' EQ '').RSZ                                    00869000
  75.          LREG  15,&BUFFER                                               00870000
  76.          ST    15,FDBBUFF-FABD(1)                                       00871000
  77. .RSZ     AIF   ('&BSIZE' EQ '').RGO                                     00872000
  78.          LREG  15,&BSIZE                                                00873000
  79.          ST    15,FDBBSIZ-FABD(1)                                       00874000
  80. .RGO     AIF   (T'&NONUM EQ 'O').RDC                           @SC88101 00875000
  81.          AIF   ('&NONUM' NE 'NONUM').ER1                       @SC88101 00876000
  82.          SR    0,0           Code 0 for chopping off numbers   @SC88101 00877000
  83.          AGO   .RCAL                                           @SC88101 00878000
  84. .RDC     LA    0,9           Read a record to a file...        @SC88101 00879000
  85. .RCAL    KCALL DISKIO,E=&E                                              00880000
  86.          MEXIT                                                          00881000
  87. .ER1     MNOTE 2,'INVALID PARAMETER ''&NONUM'''                @SC88101 00882000
  88.          MEND                                                           00883000
  89. *COPY                                                 KSETKW            00884000
  90.          MACRO                                                          00885000
  91.          KSETKW ,                                              @SC87166 00886000
  92. .* Define system-specific SET/SHOW parameters (keywords)                00887000
  93.          KW    'DESTINATION',SHODST,MIN=4                      @SC87166 00888000
  94.          KW    'DELIM',SHODLM,MIN=4                            @SC88095 00889000
  95.          MEND                                                           00890000
  96. *COPY                                                 KSETPRC           00891000
  97.          MACRO                                                          00892000
  98.          KSETPRC                                                        00893000
  99. .* System-specific SET handlers (in any order).  No operands.           00894000
  100.          PUSH  PRINT                                           @SC86355 00895000
  101.          PRINT GEN                                             @SC86355 00896000
  102. SETDST   KCALL CWDSET                                          @SC86164 00897000
  103.          B     RTRN          Preserve return code              @SC86295 00898000
  104. SETDLM   NTOKN N=SETDLM1,H=SETDLMH                             @SC88095 00899000
  105.          LTR   7,7           Exactly one character?            @SC88095 00900000
  106.          BNZ   SETDLMH       No, explain it                    @SC88095 00901000
  107.          MVC   LNDLM,0(6)    Yes, use that character           @SC88095 00902000
  108.          B     RTRN0                                           @SC88095 00903000
  109. SETDLM1  MVI   LNDLM,C' '    Turn delimiter off                @SC88095 00904000
  110.          B     RTRN0                                           @SC88095 00905000
  111. SETDLMH  PTEXT 'Line delimiter: one char or none'              @SC88095 00906000
  112.          B     SUBERR                                          @SC88095 00907000
  113.          POP   PRINT                                           @SC86355 00908000
  114.          MEND                                                           00909000
  115. *COPY                                                 KSHOPRC           00910000
  116.          MACRO                                                          00911000
  117.          KSHOPRC                                                        00912000
  118. .* System-specific SHOW handlers (in same order as KW).  No operands.   00913000
  119.          PUSH  PRINT                                           @SC86355 00914000
  120.          PRINT GEN                                             @SC86355 00915000
  121. SHODST   LA    8,UCODE                                                  00916000
  122.          LA    9,4                                                      00917000
  123.          BAL   14,SHOCHRN                                               00918000
  124.           B    SETDST                                                   00919000
  125. SHODLM   LA    8,LNDLM       Show delimiter                    @SC88095 00920000
  126.          BAL   14,SHOCHR                                       @SC88095 00921000
  127.           B    SETDLM                                          @SC88095 00922000
  128.          POP   PRINT                                           @SC86355 00923000
  129.          MEND                                                           00924000
  130. *COPY                                                 KFILKW            00925000
  131.          MACRO                                                          00926000
  132.          KFILKW ,                                              @SC87166 00927000
  133. .* Define system-specific file attribute parameters (keywords)          00928000
  134.          KW    'RECFM',SHORFM                                  @SC87166 00929000
  135.          MEND                                                           00930000
  136. *COPY                                                 KFILSET           00931000
  137.          MACRO                                                          00932000
  138.          KFILSET                                                        00933000
  139. .* Specific SET FILE handlers (any order).  No operands.                00934000
  140.          PUSH  PRINT                                           @SC87012 00935000
  141.          PRINT GEN                                             @SC87012 00936000
  142. SETRECVF MVC   FILRCF,0(6)   Copy RECFM                        @SC88120 00937000
  143.          B     RTRN0                                           @SC87012 00938000
  144. *                                                              @SC87012 00939000
  145. SETRFM   BAL   4,SETSCN                                        @SC87012 00940000
  146.          KW    'FIXED',SETRECVF                                @SC87012 00941000
  147.          KW    'VARIABLE',SETRECVF                             @SC87012 00942000
  148.          KW    ,                                               @SC87012 00943000
  149. .* add any others here                                         @SC87012 00944000
  150.          POP   PRINT                                           @SC87012 00945000
  151.          MEND                                                           00946000
  152. *COPY                                                 KFILSHO           00947000
  153.          MACRO                                                          00948000
  154.          KFILSHO                                                        00949000
  155. .* Specific SHOW FILE handlers (same order as KW).  No operands.        00950000
  156.          PUSH  PRINT                                           @SC87012 00951000
  157.          PRINT GEN                                             @SC87012 00952000
  158. SHORFM   LA    8,FILRCF                                        @SC88120 00953000
  159.          BAL   14,SHOCHR                                       @SC87012 00954000
  160.           B    SETRFM                                          @SC87166 00955000
  161. .* add any others here                                         @SC87012 00956000
  162.          POP   PRINT                                           @SC87012 00957000
  163.          MEND                                                           00958000
  164. *COPY                                                 WTEXT             00959000
  165.          MACRO                                                          00960000
  166. &LABEL   WTEXT &ARG,&LEN                                                00961000
  167. .* Display some text, e.g., WTEXT 'Hi there' or WTEXT (3),(4)           00962000
  168. .* Preserves R2-R14                                                     00963000
  169. .*  &1: 'text' (where text has no doubled ' or & characters)  OR        00964000
  170. .*  &1: adr of text (LA/R), &2: length of text (LA/R)                   00965000
  171.          GBLC  &KSYS                                           @SC88308 00966000
  172. &LABEL   PTEXT &ARG,&LEN,AREG=1,LREG=0                         @SC86295 00967000
  173.          AIF   ('&KSYS' NE 'MUSIC').TPUT                       @SC88308 00968000
  174.          BAL   15,WTEXT      'TPUT'                            @MC88304 00969000
  175.          MEXIT                                                 @SC88308 00970000
  176. .TPUT    SVC   93            'TPUT'                            @SC88308 00971000
  177.          MEND                                                           00972000
  178. *COPY                                                 FDBD              00973000
  179.          MACRO                                                          00974000
  180.          FDBD                                                           00975000
  181. .* Map of File Descriptor Block + File Access Block                     00976000
  182. .* Required items below: FABCOMM, FDBD-FDBLRC, FDBSIZE, FDBDATE,        00977000
  183. .* FDBDLRTR, FDBCOP, FDBINFO. See also FDBPAT.                          00978000
  184. FABD     DSECT ,                                               @SC86295 00979000
  185. FDBD     DS    0F            Beginning of short descriptor     @SC86295 00980000
  186. FDBBUFF  DS    A             Buffer ptr                        @SC86295 00981000
  187. FDBBSIZ  DS    F             Max record length                 @SC86295 00982000
  188. FDBRCF   DS    C             Record format                     @SC86295 00983000
  189. FDBFLGS  DS    X             Flags                             @SC86295 00984000
  190. FDBACTV  EQU   X'80'         File is already open              @SC86295 00985000
  191. * SVATT  EQU   X'40'         Preserve attributes               @SC90033 00985500
  192. * APPN   EQU   X'10'         DISP=MOD                          @SC86295 00986000
  193. FWRITE   EQU   X'04'         File opened in WRITE mode                  00987000
  194. FDBLRC   DS    H             File record length                @SC86295 00988000
  195. FDBSIZE  DS    F             File size in Kbytes               @SC88235 00990000
  196. FDBCOP   EQU   *-FDBD        Length to copy for OPEN           @SC90037 00990500
  197. FDBDATE  DS    XL7,X         Time stamp: packed yyyymmddhhmmss @SC88235 00991000
  198. FDBINFO  EQU   *-FDBD        Length of info returned                    00992000
  199. FABLRTR  DS    F             Record length for truncation      @SC88120 00993000
  200. FABUNIT  DS    X             File Unit Number                           00994000
  201. FABRC    DS    X             Return code on last file operation         00995000
  202. FABCOMM  DS    CL8           Last I/O command executed                  00996000
  203. FABFN    DS    CL22          MUSIC filename & code                      00997000
  204. FABDWDS  EQU   (*-FABD+7)/8                                    @SC86295 00998000
  205.          MEND                                                           00999000
  206. *COPY                                                 FDBPAT            01000000
  207.          MACRO                                                          01001000
  208.          FDBPAT &N,&RFM,&SIZ                                   @SC88120 01002000
  209. .* Define system-dependent part of output FDB patterns                  01003000
  210. .*  &1: variable-name prefix (or null if defining init. values)         01004000
  211. .*  &2: RECFM (1-char), &3: LRECL (skip rest of FDB if omitted)@SC88120 01005000
  212.          LCLC  &R,&F,&L,&S                                     @SC90037 01006000
  213.          AIF   ('&N' EQ '').ALC                                @SC86316 01007000
  214. &R       SETC  'RCF'                                           @SC88120 01008000
  215. &F       SETC  'FLGS'                                          @SC88120 01009000
  216. &L       SETC  'LRC'                                           @SC88120 01010000
  217. &S       SETC  'FSIZ'                                          @SC90037 01010500
  218. .ALC     ANOP                                                  @SC86316 01011000
  219. &N&R     DC    C'&RFM'       RECFM                             @SC88120 01012000
  220. &N&F     DC    X'00'         Flags                             @SC88120 01013000
  221.          AIF   ('&SIZ' EQ '').DONE                             @SC88120 01014000
  222. &N&L     DC    Y(&SIZ)       LRECL                             @SC88120 01015000
  223. &N&S     DC    F'0'          File size in Kbytes               @SC90037 01015500
  224. .DONE    ANOP                                                  @SC88120 01016000
  225.          MEND                                                           01017000
  226. *COPY                                                 KSYSVAR           01018000
  227.          MACRO                                                          01019000
  228.          KSYSVAR                                                        01020000
  229.          PUSH  PRINT                                                    01021000
  230.          PRINT GEN                                                      01022000
  231. .* Define system-dependent globally-known variables                     01023000
  232. MFINDBUF DS    A             Ptr to MFIND1 I/O Buffer                   01024000
  233. UCODE    DS    CL4,C         User code                                  01025000
  234. SCODE    DS    CL4,C         Search Code                       @SC88308 01026000
  235. FCODE    DS    CL4           Code located by MFINDX                     01027000
  236. *   Extra FDB for file manipulations                                    01028000
  237. DSKSTT   DS    0F                                                       01029000
  238.          DS    XL(FABDWDS*8)   Room for FDB                    @SC86295 01030000
  239. *   MFIO Basic Caller's Request Block                                   01031000
  240. DSKST    MFARG 0,RLAB=ZRC,ULAB=ZLU,PICT=Y                               01032000
  241.          MFARG NAME=0,INFIN=0,INFOUT=0,ARG=0                            01033000
  242.          MFARG PHYS=0,UCTL=0,UINFO=0,TAG=0                              01034000
  243.          MFARG EOFPT=0,FSARG=0                                          01035000
  244.          MFGEN ,                                                        01036000
  245. *   All other MFIO Control Blocks                                       01037000
  246. MFNAME   MFVAR NAME,PRE=MF,PICT=Y                                       01038000
  247. ZINFIN   MFVAR INFIN,PRE=MFI,PICT=Y                                     01039000
  248. ZINFOUT  MFVAR INFOUT,PRE=MFO,PICT=Y                                    01040000
  249. ZARG     MFVAR ARG,PRE=MF,PICT=Y                                        01041000
  250. ZPHYS    MFVAR PHYS,PRE=MF,PICT=Y                                       01042000
  251. ZUCTL    MFVAR UCTL,PRE=MF,PICT=Y                                       01043000
  252. ZUINFO   MFVAR UINFO,PRE=MF,PICT=Y                                      01044000
  253. MFTAG    MFVAR TAG,PRE=MF,PICT=Y                                        01045000
  254. ZEOFPT   MFVAR EOFPT,PRE=MF,PICT=Y                                      01046000
  255. ZFSARG   MFVAR FSARG,PRE=FS,PICT=Y                                      01047000
  256. *          Variables for file directory search                          01048000
  257. NXFLG    DS    X             Search Flags                               01049000
  258. NFERR    EQU   X'01'         Error on MFIND1                            01050000
  259. NFEND    EQU   X'02'         End of search on MFINDX                    01051000
  260. NFSOK    EQU   X'04'         Search in progress                         01052000
  261. NFSERRS  EQU   X'08'         Error in MFINDX                            01053000
  262. NFWLD    EQU   X'10'         Wildcard search necessary                  01054000
  263. NFFND    EQU   X'20'         Found at least one file in search @SC88308 01055000
  264. *                                                                       01056000
  265. DESTL    DS    X             Non-zero if CWD set.                       01057000
  266. *                                                                       01058000
  267. NXFN     DS    CL22          Pattern filespec                           01059000
  268. LCFN     DS    CL22          Located filename                           01060000
  269. NXFNL    DS    F             Length of Pattern filespec                 01061000
  270. PARMAREA DS    10F           Parameter passing block                    01062000
  271. NXFLTYP  DS    F             MFINDX Filetype                            01063000
  272. NXBKNUM  DS    F             MFINDX Backup number                       01064000
  273. NXDIRLOC DS    F             MFINDX Directory Location                  01065000
  274. NXSVFLG  DS    H             MFINDX Flags                               01066000
  275. GTPB     DS    3F            Ptrs for terminal read                     01067000
  276. *                                                                       01068000
  277. ICPRGS   DS    4F            Save area for interception code            01069000
  278. SVCOPTR  DS    2F            Buffer Output and End ptrs                 01070000
  279. SVCFLG   DS    X             System Intercept Flag                      01071000
  280. INTERCPT EQU   X'01'         Interception in Progress                   01072000
  281.          POP   PRINT                                                    01073000
  282.          MEND                                                           01074000
  283. *COPY                                                 KSYSTF            01075000
  284.          MACRO                                                          01076000
  285.          KSYSTF                                                         01077000
  286. .* Define system-dependent globally-known constants and init. variables 01078000
  287. .*  symb .DS + label &P.DEFS mark start of variables/init. values       01079000
  288.          GBLC  &STORDS                                         @SC89268 01079500
  289.          LCLC  &P                                                       01080000
  290.          PUSH  PRINT                                                    01081000
  291.          PRINT GEN                                                      01082000
  292.          AIF   ('&SYSECT' EQ '&STORDS').DS                     @SC89268 01083000
  293. &P       SETC  'I'           For initial values                @SC88308 01084000
  294. WTEXT    STM   14,1,ICPRGS   Save                              @MC88304 01085000
  295.          TM    SVCFLG,INTERCPT  Intercepting ?                 @MC88304 01086000
  296.          BO    WTXICP        Yes, do it                        @MC88304 01087000
  297.          TPUT  (1),(0)                                         @MC88304 01088000
  298.          B     WTXRET                                          @MC88304 01089000
  299. WTXICP   KCALL ICPTYP        Call interception code            @MC88304 01090000
  300. WTXRET   LM    14,1,ICPRGS   Restore                           @MC88304 01091000
  301.          BR    R15                                             @MC88304 01092000
  302. *                                                              @MC88304 01093000
  303.          ADCON ICPTYP                                          @MC88304 01094000
  304. *                                                                       01095000
  305. KSYSETOA DC    A(RATOA)      Override E/A table for TTY        @SC88301 01096000
  306. KSYSATOE DC    A(ATORA)      Override A/E                      @SC88301 01097000
  307.          ADCON GETLIN                                                   01098000
  308. F10      DC    F'10'                                                    01099000
  309. F17      DC    F'17'                                                    01100000
  310. FM17     DC    F'-17'                                                   01101000
  311. SYSATR   DC    AL1(ADOT,ABL+2,AI,A4)  ."I4  System type=MUSIC  @SC88273 01102000
  312. LSYSATR  EQU   *-SYSATR      Length of stuff for A-packet      @SC88273 01103000
  313. LOGNAM   DC    C'KERMIT.LOG'                                            01104000
  314. REPNAM   DC    C'KERMIT.REPLY'                                          01105000
  315. SYSTAKE  DC    C'*COM:SYSTEM.KERMINI' File type                         01106000
  316. LSYST    EQU   *-SYSTAKE                                       @SC86295 01107000
  317. USRTAKE  DC    C'KERMIT.INI' User for init file                         01108000
  318. LUSRT    EQU   *-USRTAKE                                                01109000
  319. ASTER    DC    C'*'          Search all default                @SC88308 01110000
  320. BLNAME   DC    CL22' '       Blank name                                 01111000
  321. QUEST    DC    C'?'          Question mark wildcard                     01112000
  322. KMAIL1   DC    C'KERMAIL '      System cmd for invoking mail   @SC90037 01112100
  323. KMAIL2   DC    C' '                                            @SC90037 01112200
  324. KMAIL3   DC    C' '                                            @SC90037 01112300
  325. KPRNT1   DC    C'KERMPRT '      System cmd for printing        @SC90037 01112400
  326. KPRNT2   DC    C' '                                            @SC90037 01112500
  327. KPRNT3   DC    C' '                                            @SC90037 01112600
  328. KSUBM1   DC    C'KERMSUB '      System cmd for submitting job  @SC90037 01112700
  329. KSUBM2   DC    C' '                                            @SC90037 01112800
  330. KSUBM3   DC    C' '                                            @SC90037 01112900
  331. * Default File Creation Values...                                       01113000
  332. ZINFDEF  DC    F'32',F'-100',F'-1',H'80',X'0400',X'0000C0C0'            01114000
  333. LZINFDEF EQU   *-ZINFDEF                                                01115000
  334. * Read Plist                                                            01116000
  335. TRM      MFARG IO,(RD,FILL),U=9,ARG=TRMARG,PHYS=TRMPHYS                 01117000
  336.          MFGEN                                                          01118000
  337. * Write Plist                                                           01119000
  338. PRT      MFARG IO,(WR,TRUNC),U=6,ARG=TRMARG,PHYS=TRMPHYS                01120000
  339.          MFGEN                                                          01121000
  340. TRMARG   MFVAR ARG,PRE=TRM                                              01122000
  341. TRMPHYS  MFVAR PHYS,PRE=TRM                                             01123000
  342. KSYSNIT  CSECT                                                 @SC89215 01123500
  343. .DS      ANOP                                                           01124000
  344. &P.DEFS  DS    0D                                                       01125000
  345. &P.LNDLM DC    C' '          Initially no delimiter            @SC88095 01126000
  346. &P.KPRPL DC    AL1(L'KPRPT)                                    @SC89268 01127000
  347. &P.KPRPT DC    C'Kermit-MUSIC>'                                         01128000
  348.          ORG   &P.KPRPT+20                                     @SC87268 01129000
  349.          POP   PRINT                                                    01130000
  350.          MEND                                                           01131000
  351. *COPY                                                 KSYSBUF           01132000
  352.          MACRO                                                          01133000
  353.          KSYSBUF                                                        01134000
  354. .* Store buffer ptrs from R1 and increment R1 for specific buffers      01135000
  355.          ST    1,MFINDBUF    MFIND1 I/O Buffer                          01136000
  356.          A     1,=F'5120'    10 * 512 byte buffers                      01137000
  357.          ST    1,GTPB        Terminal interactive read buffer           01138000
  358.          LA    1,130(1)                                                 01139000
  359.          MEND                                                           01140000
  360. *COPY                                                 SSYMS             01141000
  361.          MACRO                                                          01142000
  362.          SSYMS                                                          01143000
  363. .* Set global symbols for conditional assembly                          01144000
  364.          GBLC  &KVRSN,&KSYS,&KDATE,&RTN,&TYPCMD,&S1CMD,&KCONT  @SC88309 01145000
  365.          GBLC  &KEDIT,&STORDS,&KTAG                            @SC90067 01145500
  366.          GBLA  &MAXLR,&MAXBS                                   @SC86268 01146000
  367. &KSYS    SETC  'MUSIC'       System name                                01147000
  368.   MNOTE '*** Kermit-&KSYS release &KVRSN..&KEDIT &KTAG (&KDATE) ***'    01148000
  369. &MAXLR   SETA  32767         Max lrecl                                  01149000
  370. &MAXBS   SETA  32767         Max blksize                                01150000
  371. &S1CMD   SETC  'C2'          S/1 command prefix                @LP88187 01151000
  372. &KCONT   SETC  'T'           Default controller type TTY       @SC88309 01152000
  373.          PUSH  PRINT                                                    01153000
  374.          PRINT GEN                                                      01154000
  375. MAXWT    EQU   230           Max WRTERM buffer                          01155000
  376. MAXRT    EQU   230           Max RDTERM buffer                          01156000
  377. LFID     EQU   22            Max length of filespec                     01157000
  378. &TYPCMD  SETC  'LIST'        Host command for TYPE             @SC86299 01158000
  379. TYPMIN   EQU   4             Min abbrv of system TYPE cmd or 2 @SC86299 01159000
  380. FBRK1    EQU   C'<'          Starting character for options    @SC89218 01159300
  381. FBRK2    EQU   C'>'          Ending character for options      @SC89218 01159600
  382. KMAXE    EQU   1920-7        < 9025  Kermit extended max pkt   @SC87351 01160000
  383. STKDWDS  EQU   511           Size of save-area stack           @SC87012 01161000
  384. &STORDS  SETC  'KSTORG'      Storage DSECT for Kermit globals  @SC89268 01161200
  385. KWRKBASE EQU   11            Base register for work area       @SC89268 01161400
  386. KSUBBASE EQU   12            Base register for CSECT           @SC89268 01161600
  387.          POP   PRINT                                                    01162000
  388.          MEND                                                  @SC86268 01163000
  389. *COPY                                                 SYSMACS           01164000
  390.          MACRO                                                          01165000
  391.          SYSMACS                                                        01166000
  392. .* Include system control block definition macros and list all macros   01167000
  393.  MNOTE '---MACROs: CALL, FREEMAIN, GETMAIN, LOCORE, MFARG, MFGEN,'      01168000
  394.  MNOTE '---        MFREQ, MFSET, MFVAR, MUSVC, PRIVS, REGS, USRCOM'     01169000
  395.          USING $LOCORE,0                                                01170000
  396. $LOCORE  LOCORE ,                                                       01171000
  397.          ORG   $LOCORE+X'800'                                           01172000
  398.          USRCOM                                                         01173000
  399.          MUSVC                                                          01174000
  400.          PRIVS  ,                                                       01175000
  401. UPRIVS   EQU    $JOBFGS+4                                               01176000
  402.          REGS                                                           01177000
  403.          MEND                                                  @SC86268 01178000
  404. *COPY                                                 STRTMSGS          01179000
  405.          MACRO                                                          01180000
  406. &LABEL   STRTMSGS                                                       01181000
  407. .* Print system-dependent start-up messages                             01182000
  408. &LABEL   CLI   S1HND,XON                                       @SC87338 01183000
  409.          BNE   STRT1Z                                          @SC87338 01184000
  410.          CLI   TRMTP,C'T'                                      @SC88308 01185000
  411.          BE    STRT1Z                                          @SC88308 01186000
  412.          CLI   TRMTP,C'V'                                      @SC89020 01186300
  413.          BE    STRT1Z                                          @SC89020 01186600
  414.          WTEXT 'Handshake is XON -- not needed'                @SC87338 01187000
  415. STRT1Z   DS    0H                                              @SC87338 01188000
  416.          MEND                                                  @SC87338 01189000
  417. *COPY                                                 KMAIN             01190000
  418.          MACRO                                                          01191000
  419. &LABEL   KMAIN &TYPE                                                    01192000
  420. .* Linkage conventions with system.                                     01193000
  421. .*  &1: ENTER if entering, RETURN if returning                          01194000
  422.          AIF   ('&TYPE' NE 'RETURN').ENT                       @SC89268 01195000
  423. &LABEL   L     13,4(13)      Unlink                            @SC86295 01196000
  424.          ST    15,16(13)     Save return code                  @SC86295 01197000
  425.          LA    0,STODWDS+STKDWDS                               @SC87012 01198000
  426.          LR    1,KWRKBASE                                      @SC89268 01199000
  427.          DMSFRET DWORDS=(0),LOC=(1)                            @SC86295 01200000
  428.          LM    14,12,12(13)  Restore registers                 @SC86295 01201000
  429.          BR    14                                              @SC86295 01202000
  430.          MEXIT ,                                               @SC89268 01203000
  431. .ENT     AIF   ('&TYPE' NE 'ENTER').OTH                        @SC89268 01204000
  432.          LR    KSUBBASE,15                                     @SC89268 01205000
  433.          L     10,=A(COMMON) Common code addressibility        @SC86316 01206000
  434.          LA    0,STODWDS+STKDWDS                               @SC87012 01207000
  435.          DMSFREE DWORDS=(0)  Get storage for vars + stack      @SC86295 01208000
  436.          LR    KWRKBASE,1    Get addressibility                @SC89268 01209000
  437.          LR    0,1                                             @SC86295 01210000
  438.          LA    1,8*STODWDS   Length of storage                 @SC86295 01211000
  439.          SR    15,15         Zero fill                         @SC86295 01212000
  440.          MVCL  0,14                                            @SC86295 01213000
  441.          LR    15,0          Start of stack                    @SC86295 01214000
  442.          A     0,=A(8*STKDWDS) End of stack                    @SC87012 01215000
  443.          STM   15,0,STKPTR                                     @SC86295 01216000
  444.          ST    15,STKLO                                        @SC89089 01217000
  445.          LM    15,1,16(13)   Restore registers                 @SC86295 01218000
  446.          MEXIT ,                                               @SC89268 01219000
  447. .OTH     MNOTE 12,'Invalid type &TYPE'                         @SC89268 01220000
  448.          MEND                                                  @SC89268 01221000
  449.